﻿using System;
using System.Collections.Generic;
using System.Text;
using WsProtocol.IEC62056.DataTypeClass;

namespace WsProtocol.IEC62056.CosemACSE
{
    class ACSE_PushBlock   //分块push
    {
        public static int Response(ref string frameData, CosemObject OI, ref string errorinfo)
        {
            int iResult = 0;
            try
            {
                if (string.IsNullOrEmpty(frameData)) return -1;

                //加入Push中间多余的字节的解析
                frameData = frameData.Remove(0,16);
                //去掉多余字节后的帧数据解析
                if (OI == null)
                    OI = new CosemObject();
                if (OI.DataNode == null)
                {
                    OI.AddNode(new ElementData());  //创建一个新数据节点  
                }
                iResult = Data.AnalizeData(ref frameData, OI.DataNode, ref errorinfo);
            }
            catch (Exception ex)
            {
                errorinfo = ex.ToString();
            }
            return iResult;
        }
    }
}
